package com.example.lombok;

import lombok.Getter;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author shanchong
 * @date 2019-06-23
 **/

public class GetterDemo {

    @Getter(lazy = true)
    private final Integer getterDemo = getInstance();

    private static Integer getInstance(){
        return new Integer(12);
    }

    /**
     * @Getter(lazy=true)：可以替代经典的Double Check Lock样板代码
     * @param args
     */
    public static void main(String[] args) {
        GetterDemo getterDemo = new GetterDemo();
        Integer instance = getterDemo.getGetterDemo();
        System.out.println(instance);
    }


}
